package com.thinker.loan.consumer.controller;

import com.thinker.loan.consumer.model.LoanApplicationRequest;
import com.thinker.loan.consumer.service.LoanProcessingService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/loans")
@RequiredArgsConstructor
public class LoanController {
    private final LoanProcessingService processingService;

    @PostMapping
    public LoanApplicationRequest applyLoan(@RequestBody LoanApplicationRequest request) {
        return processingService.processLoan(request);
    }
}
